#define _CRT_SECURE_NO_WARNINGS 1

#include "list.h"


void testList1()
{
	LTNode* plist = STInit();

	STPushback(plist, 1);
	STPushback(plist, 2);
	STPushback(plist, 3);
	STPushback(plist, 4);
	STPushback(plist, 5);
	STPushback(plist, 6);
	LTPrint(plist);

	STPushFront(plist, 10);
	LTPrint(plist);

}

void testList2()
{
	LTNode* plist = STInit();

	STPushFront(plist, 10);
	STPushFront(plist, 20);
	STPushFront(plist, 30);
	STPushFront(plist, 40);
	LTPrint(plist);

	STPopFront(plist);
	LTPrint(plist);

	STPopFront(plist);
	LTPrint(plist);

	STPopFront(plist);
	LTPrint(plist);

	STPopFront(plist);
	LTPrint(plist);

	/*STPopFront(plist);
	LTPrint(plist);*/

}

void testList3()
{
	LTNode* plist = STInit();

	STPushback(plist, 1);
	STPushback(plist, 2);
	STPushback(plist, 3);
	STPushback(plist, 4);
	STPushback(plist, 5);
	STPushback(plist, 6);
	LTPrint(plist);

	LTNode* pos = STFind(plist, 3);
	if(pos)
	{
		pos->val *= 10;
	}
	LTPrint(plist);
	
	STInsert(pos, 300);
	LTPrint(plist);

	STInsert(plist, -1);
	LTPrint(plist);

	STInsert(plist, -2);
	LTPrint(plist);
}

void testList4()
{
	LTNode* plist = STInit();

	STPushback(plist, 1);
	STPushback(plist, 2);
	STPushback(plist, 3);
	STPushback(plist, 4);
	STPushback(plist, 5);
	STPushback(plist, 6);
	LTPrint(plist);

	LTNode* pos = STFind(plist, 3);
	if (pos)
	{
		STErase(pos);
		pos = NULL;
	}
	LTPrint(plist);

	STDestroy(plist);
	plist = NULL;
	
}

int main()
{
	testList4();


	return 0;
}